package com.augurit.agmobile.agwater5.drainage.supervise.view

import android.app.Activity
import android.os.Bundle
import android.widget.ImageView
import com.augurit.agmobile.agwater5.drainage.common.constant.StringConstant
import com.augurit.agmobile.agwater5.drainage.common.ex.launchActivity
import com.example.arm.base.BaseActivity
import com.example.arm.http.imageloader.ImageLoader
import com.example.drainage.R
import com.example.drainage.base.ktexpand.visible
import com.example.drainage.databinding.ActivitySuperviseSignDetailBinding
import com.example.drainage.http.imageloader.ImageConfigImpl
import com.example.drainage.http.imageloader.ImageConfigImplBuilder
import org.kodein.di.instance

/**
 * @author 创建人 ：yanghaozhang
 * @version 1.0
 * @package 包名 ：com.augurit.agmobile.agwater5.drainage.supervise.view
 * @createTime 创建时间 ：2022/1/4
 * @modifyBy 修改人 ：
 * @modifyTime 修改时间 ：
 * @modifyMemo 修改备注：
 */
class SuperviseSignDetailActivity : BaseActivity<ActivitySuperviseSignDetailBinding>() {

//    private var facilityType: SuperviseType = SuperviseType.Reservoir

//    private var role: SuperviseRole = SuperviseRole.TeamMembers

    private var id: String? = null

    private val mImageLoader: ImageLoader<ImageConfigImpl> by instance()

    companion object {
        fun jump(activity: Activity, id: String) {
            activity.launchActivity<SuperviseSignDetailActivity> {
                putExtra(StringConstant.KEY_ID, id)
            }
        }
    }

    override fun initView(savedInstanceState: Bundle?): ActivitySuperviseSignDetailBinding {
        return ActivitySuperviseSignDetailBinding.inflate(layoutInflater)
    }

    override fun initData(savedInstanceState: Bundle?) {
        initIntent()
        initView()
        initViewModel()
        initData()
    }

    //-----------------已定义方法---------------------------
    private fun initIntent() {
        if (intent.hasExtra(StringConstant.KEY_ID)) {
            id = intent.getStringExtra(StringConstant.KEY_ID)
        }
    }

    private fun initView() {
//        immersionStatusBar()
//        mBinding.apply {
//            titlebar.setTitle(facilityType.typeName)
//                .setTitleTextColor("#222222".toColor())
//                .setTitleTextSize(18f)
//                .setLeftImageIcon(R.mipmap.back_arrow, 14)
//                .setLeftImageTint("#222222".toColor())
//                .setLeftImageClick { finish() }
//                .setImmersion(true)
//                .setBackgroundResource(R.color.white)
//
//        }
        binding.apply {
            ivGroupLeader.visible = true
            ivAdminDepartment.visible = true
            ivTeamMembers0.visible = true
            ivTeamMembers1.visible = true
            ivTeamMembers2.visible = true
            val url1 ="/storage/emulated/0/Android/data/com.example.drainage/cache/2022-01-06_16-09-48_sign_GroupLeader.jpg"
            var url2 = "/storage/emulated/0/Android/data/com.example.drainage/cache/2022-01-06_16-12-28_sign_GroupLeader.jpg"
//            url2 = url1
            mImageLoader.loadImage(this@SuperviseSignDetailActivity, ImageConfigImplBuilder {
                imageView = ivGroupLeader
                url = url2
            })
            mImageLoader.loadImage(this@SuperviseSignDetailActivity, ImageConfigImplBuilder {
                imageView = ivAdminDepartment
                url = url2
            })
            mImageLoader.loadImage(this@SuperviseSignDetailActivity, ImageConfigImplBuilder {
                imageView = ivTeamMembers0
                url = url2
            })
            mImageLoader.loadImage(this@SuperviseSignDetailActivity, ImageConfigImplBuilder {
                imageView = ivTeamMembers1
                url = url2
            })
//            mImageLoader.loadImage(this@SuperviseSignDetailActivity, ImageConfigImplBuilder {
//                imageView = ivTeamMembers2
//                url = url2
//            })
            ivTeamMembers2.scaleType = ImageView.ScaleType.CENTER_CROP
            ivTeamMembers2.setImageResource(R.mipmap.icon_certificate_no_sign)
        }
    }

    private fun initViewModel() {

    }

    private fun initData() {

    }
}